package com.dreamer.repository.lottery;

import com.dreamer.domain.lottery.Gift;
import com.dreamer.domain.user.Accounts;
import com.dreamer.repository.mobile.BaseDaoImpl;
import org.hibernate.query.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by huangfei on 06/07/2017.
 */
@Repository
public class GiftDao extends BaseDaoImpl<Gift> {

    public List<Gift> findByLid(Integer lid) {
        String hql = "from Gift gift where gift.lid = :lid order by sort desc";
        Query query = getSessionFactory().getCurrentSession().createQuery(hql);
        query.setParameter("lid", lid);
        return query.list();
    }

}
